<template>
  <div>
    <!-- 搜索 -->
    <search></search>
    <!-- 轮播图swiper -->
    <swiper></swiper>
    <!-- 分类category -->
    <category></category>
    <!-- 广告 -->
    <ad></ad>
    <!-- 商品推荐 -->
    <recommend></recommend>

    <!-- 商品 floor-->
  <floor></floor>
    <!-- 热卖商品 -->
  <hotGoods></hotGoods>
    <!-- 底部菜单栏 -->
    <tab-bar></tab-bar>
  </div>
</template>

<script>

import * as api from "@/request/api/home.js"; //*通配符代表这个文件里所有方法
import search from "./components/search";
import swiper from "./components/swiper";
import category from "./components/category";
import ad from "./components/ad";
import recommend from "./components/recommend";
import floor from "./components/floor";
import hotGoods from "./components/hotGoods";
export default {
  data() {
    return {
      

     
    };
  },

  components: {
    search,
    swiper,
    category,
    ad,
    recommend,
    floor,
    hotGoods
  },
  methods: {
    async API_getIndexInfo() {
      return await api.getIndexInfo(); //获取首页信息接口
    }
  },
  async created() {
    let res = await this.API_getIndexInfo();
    

    this.$eventBus.$emit("getIndexInfo", res.data.data);
  }
};
</script>

<style>
body{
  background: #f0f0f0;
}
</style>